package cn.wp.ewallet.upms.dao.impl;

import cn.wp.common.core.dao.SqlString;
import cn.wp.ewallet.upms.dao.PaObjectRoleRelDao;
import cn.wp.ewallet.upms.model.entity.PaObjectRoleRelDo;
import org.springframework.stereotype.Repository;
import cn.wp.common.core.dao.JdbcSupportTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 角色关系数据访问层-数据访问层实现
 * Created by ganjie on 2020/01/08
 */
@Repository
public class PaObjectRoleRelDaoImpl implements PaObjectRoleRelDao {

    @Autowired
    private JdbcSupportTemplate jdbcSupportTemplate;

    @Override
    public void insertPaObjectRoleRel(PaObjectRoleRelDo paObjectRoleRelDo) {
        jdbcSupportTemplate.insert(paObjectRoleRelDo);
    }

    @Override
    public PaObjectRoleRelDo selecPaObjectRoleRelByUserId(String userId) {
        SqlString sqlString = SqlString.newInstance();
        sqlString.add("select *");
        sqlString.add("from pa_object_role_rel");
        sqlString.add("where OBJECT_ID = ?");
        return jdbcSupportTemplate.selectObject(sqlString.build(),new Object[]{userId},PaObjectRoleRelDo.class);

    }
}



